<template>
  <div class="popup">
    <div class="close">
      <i class="iconfont icon-guanbi"></i>
    </div>
    <div class="content">
      <div class="tab">
        <span @click="open_login" :class="{ active: login_page }">登录</span>
        <span @click="open_reg" :class="{ active: !login_page }">注册</span>
      </div>
      <login-form v-if="login_page"></login-form>
      <reg-form v-else></reg-form>
      <el-checkbox name="type">
        我已经阅读并同<strong>用户条款和隐私条款</strong>(注册后可申请成为摄影师)
      </el-checkbox>
      <p class="already">已有账号，直接登录</p>
      <div class="equipment">
        <i class="iconfont icon-iconfontqq"></i>
        <i class="iconfont icon-weixin"></i>
      </div>
    </div>
  </div>
</template>

<script>
import LoginForm from "@/components/common/login/LoginForm";
import RegForm from "@/components/common/login/RegForm";
export default {
  data() {
    return {
      login_page: true,
    };
  },
  components: {
    LoginForm,
    RegForm,
  },
  methods: {
    open_login() {
      this.login_page = true;
    },
    open_reg() {
      this.login_page = false;
    },
  },
};
</script>

<style lang="scss" scoped>
.popup {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 40%;
  min-width: 580px;
  height: 500px;
  transform: translate(-50%, -50%);
  z-index: 9999;
  background-color: #fff;
  border: 1px solid #eee;
  .close {
    height: 40px;
    line-height: 40px;
    text-align: right;
    padding-right: 4%;
    i {
      cursor: pointer;
    }
  }
  .content {
    width: 100%;
    height: calc(100% - 40px);
    padding: 0 4%;
    overflow: auto;
    .tab {
      text-align: center;
      font-weight: bold;
      span {
        font-size: 22px;
        padding: 0 20px;
        cursor: pointer;
        &.active {
          color: $mainColor;
        }
      }
    }
    .already {
      position: relative;
      text-align: center;
      color: #bbbfbe;
      margin-top: 20px;
      &::before {
        content: "";
        display: block;
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 33%;
        height: 1px;
        background-color: #bbbfbe;
      }
      &::after {
        content: "";
        display: block;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 33%;
        height: 1px;
        background-color: #bbbfbe;
      }
    }
    .equipment {
      display: flex;
      justify-content: center;
      margin: 20px 0;
      i {
        width: 55px;
        height: 55px;
        border-radius: 50%;
        color: #fff;
        background-color: $mainColor;
        text-align: center;
        line-height: 55px;
        font-size: 26px;
        margin: 0 20px;
        cursor: pointer;
        &:hover {
          background-color: #42ab9e;
        }
      }
    }
  }
}
strong {
  color: #000;
  font-weight: bold;
  border-bottom: 1px dashed #000;
}
::v-deep {
  .el-checkbox__input.is-checked .el-checkbox__inner,
  .el-checkbox__input.is-indeterminate .el-checkbox__inner {
    background-color: $mainColor;
    border-color: $mainColor;
  }
  .el-checkbox__input.is-checked + .el-checkbox__label {
    color: $mainColor;
  }
  .el-checkbox__input.is-focus .el-checkbox__inner {
    border-color: $mainColor;
  }
}
::v-deep {
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: $mainColor;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
  .el-button {
    width: 100%;
    background-color: $mainColor;
    color: #fff;
  }
  .el-button:focus,
  .el-button:hover {
    background-color: #42ab9e;
  }
  .el-input__inner:hover,
  .el-input__inner:focus {
    border-color: $mainColor;
  }
}
</style>
